<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition>

        <p:dialog id="TerceirosEditDlg" widgetVar="TerceirosEditDialog" modal="true" resizable="false" appendTo="@(body)" header="#{bundle.EditTerceirosTitle}">
            <h:form id="TerceirosEditForm">
                <h:panelGroup id="display">
                    <p:panelGrid columns="2" rendered="#{terceirosController.selected != null}">
                        <p:outputLabel value="#{bundle.EditTerceirosLabel_id}" for="id" />
                        <p:inputText id="id" value="#{terceirosController.selected.id}" title="#{bundle.EditTerceirosTitle_id}" required="true" requiredMessage="#{bundle.EditTerceirosRequiredMessage_id}"/>
                        <p:outputLabel value="#{bundle.EditTerceirosLabel_nome}" for="nome" />
                        <p:inputText id="nome" value="#{terceirosController.selected.nome}" title="#{bundle.EditTerceirosTitle_nome}" required="true" requiredMessage="#{bundle.EditTerceirosRequiredMessage_nome}"/>
                        <p:outputLabel value="#{bundle.EditTerceirosLabel_cpf}" for="cpf" />
                        <p:inputText id="cpf" value="#{terceirosController.selected.cpf}" title="#{bundle.EditTerceirosTitle_cpf}" />
                        <p:outputLabel value="#{bundle.EditTerceirosLabel_dataCadastramento}" for="dataCadastramento" />
                        <p:calendar id="dataCadastramento" pattern="MM/dd/yyyy" value="#{terceirosController.selected.dataCadastramento}" title="#{bundle.EditTerceirosTitle_dataCadastramento}"  showOn="button"/>
                        <p:outputLabel value="#{bundle.EditTerceirosLabel_rg}" for="rg" />
                        <p:inputText id="rg" value="#{terceirosController.selected.rg}" title="#{bundle.EditTerceirosTitle_rg}" />
                        <p:outputLabel value="#{bundle.EditTerceirosLabel_telefone}" for="telefone" />
                        <p:inputText id="telefone" value="#{terceirosController.selected.telefone}" title="#{bundle.EditTerceirosTitle_telefone}" />
                        <p:outputLabel value="#{bundle.EditTerceirosLabel_numero}" for="numero" />
                        <p:inputText id="numero" value="#{terceirosController.selected.numero}" title="#{bundle.EditTerceirosTitle_numero}" />
                        <p:outputLabel value="#{bundle.EditTerceirosLabel_email}" for="email" />
                        <p:inputText id="email" value="#{terceirosController.selected.email}" title="#{bundle.EditTerceirosTitle_email}" />
                        <p:outputLabel value="#{bundle.EditTerceirosLabel_limite}" for="limite" />
                        <p:inputText id="limite" value="#{terceirosController.selected.limite}" title="#{bundle.EditTerceirosTitle_limite}" />
                        <p:outputLabel value="#{bundle.EditTerceirosLabel_logradouro}" for="logradouro" />
                        <p:selectOneMenu id="logradouro" value="#{terceirosController.selected.logradouro}" >
                            <f:selectItem itemLabel="#{bundle.SelectOneMessage}"/>
                            <f:selectItems value="#{logradourosController.itemsAvailableSelectOne}"
                                           var="logradouroItem"
                                           itemValue="#{logradouroItem}"/>
                        </p:selectOneMenu>
                        <p:outputLabel value="#{bundle.EditTerceirosLabel_cidade}" for="cidade" />
                        <p:selectOneMenu id="cidade" value="#{terceirosController.selected.cidade}" >
                            <f:selectItem itemLabel="#{bundle.SelectOneMessage}"/>
                            <f:selectItems value="#{cidadesController.itemsAvailableSelectOne}"
                                           var="cidadeItem"
                                           itemValue="#{cidadeItem}"/>
                        </p:selectOneMenu>
                    </p:panelGrid>
                    <p:commandButton actionListener="#{terceirosController.update}" value="#{bundle.Save}" update="display,:TerceirosListForm:datalist,:growl" oncomplete="handleSubmit(args, 'TerceirosEditDialog');"/>
                    <p:commandButton value="#{bundle.Cancel}" onclick="TerceirosEditDialog.hide()"/>
                </h:panelGroup>
            </h:form>
        </p:dialog>

    </ui:composition>
</html>
